import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class testDemo3 {
    StringTokenizer st = new StringTokenizer("");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException {
        while(!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static int n;
    static int[] a;
    static int bin(int x) {
        int l = 0,r = n;
        while(l + 1 != r) {
            int mid = (l + r)/2;
            if(a[mid] < x) l = mid;
            else r = mid;
        }
        return a[r] == x ? r : -1;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int q = in.nextInt();
        a = new int[n+1];
        for(int i = 1;i <= n;i++) a[i] = in.nextInt();
        Arrays.sort(a);
        while(q-- > 0) {
            int x = in.nextInt();
            System.out.print(bin(x) + " ");
        }
    }
}
